package com.xjj.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xjj.entity.School;
import com.xjj.entity.Vote;
import com.xjj.mapper.SchoolMapper;
import com.xjj.service.SchoolService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author sxy
 * @version 1.0
 * @date 2022/10/20 11:23
 */
@Service
public class SchoolServiceImpl extends ServiceImpl<SchoolMapper, School> implements SchoolService {
    @Resource
    private SchoolMapper schoolMapper;
    @Override
    public Page<School> getSchool(Integer current) {
        Page<School> page = new Page<>(current , 5);
        QueryWrapper<School> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("*");
        page = schoolMapper.selectPage(page,queryWrapper);
        return page;
    }

    @Override
    public void updateBySchoolId(School school) {
        schoolMapper.updateBySchoolId(school);
    }

    @Override
    public School getSchoolByKlassId(int schoolId) {
        return schoolMapper.getSchoolByKlassId(schoolId);
    }


}
